package com.core.db.execute;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * sql 查询结果封装类
 * 
 * @author 殷田
 *
 */
public class Result
{
	private PreparedStatement stmt;

	private ResultSet resultSet;

	public Result()
	{
	}

	public Result( PreparedStatement stmt, ResultSet resultSet )
	{
		this.stmt = stmt;
		this.resultSet = resultSet;
	}

	public void setStmt( PreparedStatement stmt )
	{
		this.stmt = stmt;
	}

	public ResultSet getResultSet()
	{
		return resultSet;
	}

	public void setResultSet( ResultSet resultSet )
	{
		this.resultSet = resultSet;
	}

	/**
	 * 用于关闭资源
	 */
	public void release()
	{
		try
		{
			if ( resultSet != null )
			{
				resultSet.close();
			}
		}
		catch ( SQLException se )
		{
		}
		try
		{
			if ( stmt != null )
			{
				stmt.close();
			}
		}
		catch ( SQLException se2 )
		{
		}
	}
}
